package com.thomasmoerman.dci.tmc

import java.util.Properties

import com.atomikos.jdbc.nonxa._
import com.atomikos.icatch.jta.UserTransactionImp

import javax.naming.InitialContext; 

trait Registry
  extends TransferMoneyContextFactory
  with TransactionalMoneySourceProvider
  with MoneySinkProvider
  with UpdatableAccountAspect
  with CalculatedBalanceAspect
  with MoneyTransferQueries
  with Database
  with Transactional
  with TransactionManagerComponent
  with SessionFactory
  with DataSourceComponent {
  
  val dataSource = {
	val ds = new AtomikosNonXADataSourceBean
	
	ds.setUniqueResourceName("MyDatabase")
	ds.setUser("root")
	ds.setPassword("admin")
	ds.setUrl("jdbc:mysql://localhost:3306/TMC")
	ds.setDriverClassName("com.mysql.jdbc.Driver")
	ds.setPoolSize(1)
	
	ds
  }
  
  val userTransaction = new UserTransactionImp
  
}